﻿/*
Copyright (c) 2009 Vratislav Cermak (vratacermak@gmail.com)
 
This file is part of TeachMe Project. See http://code.google.com/p/teach-me for more information.
 
TeachMe is an open source project. Using of TeachMe is free of charge.
It is distributed under GNU General Public License version 3 (GPLv3).
GPLv3 can be found at http://www.gnu.org/licenses/gpl.html.
 
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.  See the license for more details.
*/

using System;
using log4net;

namespace TeachMe.Application
{
    public static class Logging
    {
        public static void Debug(Type type, Exception exception, string message, params object[] args)
        {
            if (LogManager.GetLogger(type).IsDebugEnabled)
            {
                LogManager.GetLogger(type).Debug(String.Format(message, args), exception);
            }
        }

        public static void Debug(Type type, Exception exception, string message)
        {
            if (LogManager.GetLogger(type).IsDebugEnabled)
            {
                LogManager.GetLogger(type).Debug(message, exception);
            }
        }

        public static void Debug(Type type, string message, params object[] args)
        {
            if (LogManager.GetLogger(type).IsDebugEnabled)
            {
                LogManager.GetLogger(type).DebugFormat(message, args);
            }
        }

        public static void Debug(Type type, string message)
        {
            if (LogManager.GetLogger(type).IsDebugEnabled)
            {
                LogManager.GetLogger(type).Debug(message);
            }
        }

        public static void Error(Type type, Exception exception, string message, params object[] args)
        {
            if (LogManager.GetLogger(type).IsErrorEnabled)
            {
                LogManager.GetLogger(type).Error(String.Format(message, args), exception);
            }
        }

        public static void Error(Type type, Exception exception, string message)
        {
            if (LogManager.GetLogger(type).IsErrorEnabled)
            {
                LogManager.GetLogger(type).Error(message, exception);
            }
        }

        public static void Error(Type type, string message, params object[] args)
        {
            if (LogManager.GetLogger(type).IsErrorEnabled)
            {
                LogManager.GetLogger(type).ErrorFormat(message, args);
            }
        }

        public static void Error(Type type, string message)
        {
            if (LogManager.GetLogger(type).IsErrorEnabled)
            {
                LogManager.GetLogger(type).Error(message);
            }
        }

        public static void Warn(Type type, Exception exception, string message, params object[] args)
        {
            if (LogManager.GetLogger(type).IsWarnEnabled)
            {
                LogManager.GetLogger(type).Warn(String.Format(message, args), exception);
            }
        }

        public static void Warn(Type type, Exception exception, string message)
        {
            if (LogManager.GetLogger(type).IsWarnEnabled)
            {
                LogManager.GetLogger(type).Warn(message, exception);
            }
        }

        public static void Warn(Type type, string message, params object[] args)
        {
            if (LogManager.GetLogger(type).IsWarnEnabled)
            {
                LogManager.GetLogger(type).WarnFormat(message, args);
            }
        }

        public static void Warn(Type type, string message)
        {
            if (LogManager.GetLogger(type).IsWarnEnabled)
            {
                LogManager.GetLogger(type).Warn(message);
            }
        }

        public static void Info(Type type, Exception exception, string message, params object[] args)
        {
            if (LogManager.GetLogger(type).IsInfoEnabled)
            {
                LogManager.GetLogger(type).Info(String.Format(message, args), exception);
            }
        }

        public static void Info(Type type, Exception exception, string message)
        {
            if (LogManager.GetLogger(type).IsInfoEnabled)
            {
                LogManager.GetLogger(type).Info(message, exception);
            }
        }

        public static void Info(Type type, string message, params object[] args)
        {
            if (LogManager.GetLogger(type).IsInfoEnabled)
            {
                LogManager.GetLogger(type).InfoFormat(message, args);
            }
        }

        public static void Info(Type type, string message)
        {
            if (LogManager.GetLogger(type).IsInfoEnabled)
            {
                LogManager.GetLogger(type).Info(message);
            }
        }
    }
}
